package com.study.controller;

import com.study.pojo.entity.ReportBox;
import com.study.pojo.resp.BaserResp;
import com.study.pojo.resp.ResultMessage;
import com.study.service.DangjService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/Dj")
public class DjController {
    @Autowired
    DangjService dangjService;

    /**
     * 查询所有中心学习组的学习内容
     * @return
     */
    @RequestMapping("/findAllDj")
    public BaserResp findAllDj(){
        return dangjService.findAllStudyGroup(1);
    }

    /**
     * 查询中心组学习的讨论内容
     * @return
     */
    @RequestMapping("/findAllDjT")
    public BaserResp findAllDjT(){
        return dangjService.findAllStudyGroup(2);
    }

    /**
     * 通过学习id从redis中获取内容
     * @return
     */
    @RequestMapping("/selectOne/{studyClassify}/{studyId}")
    public BaserResp selectOne(@PathVariable("studyClassify")Integer studyClassify,@PathVariable("studyId")Integer studyId){
        return dangjService.selectOne(studyClassify,studyId);
    }

    /**
     * 通过id从redis中获取数据内容
     * @param studyId
     * @return
     */
    @RequestMapping("/findStudyGroupById/{studyId}/{studyClassify}")
    public BaserResp findNewsById (@PathVariable Integer studyId){

        return dangjService.findStudyGroupById(studyId);
    }

    /**
     * 举报箱
     */
    @RequestMapping("/insert/{rbTitle}/{rbContext}")
    public BaserResp insert(@PathVariable("rbTitle")String rbTitle,@PathVariable("rbContext")String rbContext){
        return dangjService.insert(rbTitle,rbContext);
    }
}
